/**
 *
 */
package jp.seraph.same.view.cui;

import jp.seraph.cui.AbstractCommand;
import jp.seraph.cui.InternalConsole;
import jp.seraph.cui.SystemNode;
import jp.seraph.cui.SystemNodeType;
import jp.seraph.same.controller.AgentController;

/**
 *
 */
public class RunMotionCommand extends AbstractCommand {
    public RunMotionCommand(AgentController aController,MotionEditMode aParent, InternalConsole aConsole) {
        super(aParent, aConsole);
        mController = aController;
    }

    private AgentController mController;

    /**
     * @see jp.seraph.cui.AbstractCommand#executeImpl(jp.seraph.cui.SystemNode[], int)
     */
    @Override
    protected void executeImpl(SystemNode[] aArgs, int aArgListIndex) {
        MotionData tData = (MotionData)aArgs[0];
        mController.apply(tData.getMotionModel().toMotion());
    }

    /**
     * @see jp.seraph.cui.Command#getArgumentTypes()
     */
    public SystemNodeType[][] getArgumentTypes() {
        SystemNodeType[][] tResult = new SystemNodeType[1][];
        tResult[0] = new MotionDataType[] { MotionDataType.getInstance() };

        return tResult;
    }

    /**
     * @see jp.seraph.cui.Command#getHelp()
     */
    public String getHelp() {
        return "run MotionData";
    }

    /**
     * @see jp.seraph.cui.SystemNode#getName()
     */
    public String getName() {
        return "run";
    }

    /**
     * @see jp.seraph.cui.SystemNode#getType()
     */
    public SystemNodeType getType() {
        return RunMotionCommandType.getInstance();
    }

}
